package com.hx.service;

import com.hx.mappre.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service(value = "userService")
public class UserService {
    //@Autowired(required = false)
    @Autowired(required = true)
    private UserMapper userMapper=null;
    /*
    1.使用@Autowired，默认required=true，表示被注入bean对象可以被实例化
    2.如果被注入bean对象不能被实例化，为null就需要设置@Autowired的required=false
     */
    public void check(){
        //定义成员方法
        System.out.println("校验成功!!!");
        //调用mapper的方法
        userMapper.insert();
    }
}
